<template>
	<view class="index p10">
		<view class="f-1 bf bs5 p-0-10 f18">
			<u--form labelPosition="left" :model="form" :rules="rules" labelWidth="auto" ref="uForm">
				<u-form-item label="排队号码 : " prop="pickNo" ref="item1">
					<view class="f-1 tar">{{form.serialNum}}</view>
				</u-form-item>
				<u-form-item label="等待时间 : " prop="waitTime" ref="item1">
					<view class="f-1 tar">已等待{{form.waitTime}}分钟</view>
				</u-form-item>
				<u-form-item label="取号时间 : " prop="created_at" ref="item1">
					<view class="f-1 tar">{{form.created_at}}</view>
				</u-form-item>
				<u-form-item label="类型 : " prop="type" ref="item1">
					<view class="f-1 tar">{{form.type.name}}{{form.people}}人</view>
				</u-form-item>
				<u-form-item label="操作员 : " prop="username" ref="item1">
					<view class="f-1 tar">{{form.username || '-'}}</view>
				</u-form-item>
			</u--form>
		</view>
		<view class="buts dfa tac o-h" :style="{borderColor:subColor}">
			<view class="w100 f16 c0 p10 bf" @click="handInOrder('print')">打印</view>
			<view class="w100 f16 c0 p10" @click="handInOrder('delet')" :style="{background:subColor}">删除</view>
		</view>
	</view>
</template>

<script>
	export default {
		components: {},
		data() {
			return {
				subColor: uni.getStorageSync('subject_color'),
				storeId: uni.getStorageSync('storeId'),
				uForm: null,
				form: {
					pickNo: 'A05',
					waitTime: 12,
					created_at: '2023-11-23 10:22:49',
					type: '大桌',
					username: ''
				},
				rules: {}
			}
		},
		onLoad(options) {
			if (options) {
				this.form = JSON.parse(options.row)
				console.log(this.form);
			}
			this.fetchData()
		},
		methods: {
			async fetchData() {

			},
			handInOrder(type) {
				if (type == 'delet') {
					uni.showModal({
						title: '温馨提示',
						content: '你确定删除吗？',
						success: async (res) => {
							if (res.confirm) {
								const {
									msg
								} = await this.beg.request({
									url: `${this.api.queuingUp}/${this.form.id}`,
									method: "DELETE",
								})
								uni.$u.toast(msg)
								this.fetchData()
							}
						}
					});
				} else {
					uni.$u.toast('打印')
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.buts {
		position: fixed;
		bottom: 40rpx;
		left: 50%;
		transform: translateX(-50%);
		width: 90%;
		height: 80rpx;
		border-radius: 50rpx;
		border: 2rpx solid #fff;
	}
</style>